package 货币系统;

import java.util.Scanner;

public class Main {
    //给你一个n种面值的货币系统，求组成面值为m的货币有多少种方案。
    static int N = 3010;
    static long[] f = new long[N];

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int m = in.nextInt();
        f[0] = 1;
        for (int i = 1; i <= n; i++) {
            int v = in.nextInt();
            for (int j = v; j <= m; j++) {
                f[j] += f[j - v];
            }
        }
        System.out.println(f[m]);
    }
}
